package thesis.javaclass;

import java.util.ArrayList;

import thesis.database.Factory;
import thesis.database.Service;
import thesis.database.ServiceJDBCTemplate;

public class Singleton {
	private static Singleton instance = null;
	private static String acceptTaxiImei = "";
	private static String phoneNumber;
	private static String address;
	private static int numberOfSeat;
	private static ArrayList<Double> coordinate = new ArrayList<Double>(); // coordinate
																			// of
																			// customer

	// private static String info;

	protected Singleton() {
		// Exists only to defeat instantiation.
	}

	public static Singleton getInstance() {
		if (instance == null) {
			instance = new Singleton();
		}
		return instance;
	}

	public static String getAcceptTaxiImei() {
		return acceptTaxiImei;
	}

	public static void setAcceptTaxiImei(String acceptTaxiImei) {
		Singleton.acceptTaxiImei = acceptTaxiImei;
	}

	public static String getPhoneNumber() {
		return phoneNumber;
	}

	public static void setPhoneNumber(String phoneNumber) {
		Singleton.phoneNumber = phoneNumber;
	}

	public static String getAddress() {
		return address;
	}

	public static void setAddress(String address) {
		Singleton.address = address;
	}

	public static ArrayList<Double> getCoordinate() {
		return coordinate;
	}

	public static void setCoordinate(ArrayList<Double> coordinate) {
		Singleton.coordinate = coordinate;
	}

	public static int getNumberOfSeat() {
		return numberOfSeat;
	}

	public static void setNumberOfSeat(int numberOfSeat) {
		Singleton.numberOfSeat = numberOfSeat;
	}

	public static void updateService(String phone, int status) {
		ServiceJDBCTemplate sericeJDBCTemplate = (ServiceJDBCTemplate) Factory
				.createJDBCTemplate("serviceJDBCTemplate");
		Service service = sericeJDBCTemplate.getServiceByPhone(phone);
		service.setStatus(status);
		sericeJDBCTemplate.update(service);
	}

	/*
	 * public static String getInfo() { return info; }
	 * 
	 * public static void setInfo(String info) { Singleton.info = info; }
	 */

}